package com.example.administrator.zhongyichou.activity;

import android.content.Intent;
import android.view.View;
import android.widget.Button;

import com.example.administrator.zhongyichou.adapter.MillionsHelpExpandableAdapter;
import com.example.administrator.zhongyichou.base.BaseActivity;
import com.example.administrator.zhongyichou.Bean.BaseEventBean;
import com.example.administrator.zhongyichou.config.Constants;
import com.example.administrator.zhongyichou.net.core.HttpLoader;
import com.example.administrator.zhongyichou.net.protocol.GsonBaseProtocol;
import com.example.administrator.zhongyichou.view.HeaderView;
import com.example.administrator.zhongyichou.view.MyExpandableListView;
import com.example.administrator.zhongyichou.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by lichenyu on 2017/11/22.
 * 描述：
 */

public class YoungHelpActivity extends BaseActivity {
    @BindView(R.id.headerview)
    HeaderView headerview;
    @BindView(R.id.listview)
    MyExpandableListView listview;
    @BindView(R.id.btn_next)
    Button btnNext;
    private MillionsHelpExpandableAdapter adapter;

    @Override
    protected void init() {
        ButterKnife.bind(this);
        initHead();
        adapter = new MillionsHelpExpandableAdapter(this);
        listview.setAdapter(adapter);
        //去掉箭头
        listview.setGroupIndicator(null);
    }

    @Override
    protected void responseData(GsonBaseProtocol mGsonBaseProtocal) {

    }

    @Override
    protected HttpLoader initHttpLoader() {
        return null;
    }

    @Override
    protected int initContentView() {
        return R.layout.yound_help_activity;
    }

    @Override
    public boolean onEventBus(BaseEventBean baseEventBean) {
        if (baseEventBean.code == Constants.TYPE_7) {
            Intent welfareIntent = new Intent(this, MutualAidActivity.class);
            startActivity(welfareIntent);
        }
        return false;
    }

    private void initHead() {
        headerview.setTitle("互助行动详情");
        headerview.bindOnclickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                switch (v.getId()) {
                    case HeaderView.LEFT:
                        finish();
                        break;
                }
            }
        });
    }

    @OnClick({R.id.btn_next})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.btn_next:
                Intent intent = new Intent(this, HealthNotificationActivity.class);
                intent.putExtra("title", "中青年大病互助行动");
                intent.putExtra("disease", "30种大病");
                startActivity(intent);
                break;
        }
    }
}
